home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 3 / Amiga Tools 3.iso / grafik / raytracing / rayshade-4.0.6.3 / libray / libobj / hf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  2.7 KB  |  101 lines

  1. /*
  2.  * hf.h
  3.  *
  4.  * Copyright (C) 1989, 1991, Craig E. Kolb
  5.  * All rights reserved.
  6.  *
  7.  * This software may be freely copied, modified, and redistributed
  8.  * provided that this copyright notice is preserved on all copies.
  9.  *
  10.  * You may not distribute this software, in whole or in part, as part of
  11.  * any commercial product without the express consent of the authors.
  12.  *
  13.  * There is no warranty or other guarantee of fitness of this software
  14.  * for any purpose.  It is provided solely "as is".
  15.  *
  16.  * hf.h,v 4.1 1994/08/09 07:59:16 explorer Exp
  17.  *
  18.  * hf.h,v
  19.  * Revision 4.1  1994/08/09  07:59:16  explorer
  20.  * Bump version to 4.1
  21.  *
  22.  * Revision 1.1.1.1  1994/08/08  04:52:09  explorer
  23.  * Initial import.  This is a prerelease of 4.0.6enh3, or 4.1 possibly.
  24.  *
  25.  * Revision 4.0  91/07/17  14:38:19  kolb
  26.  * Initial version.
  27.  * 
  28.  */
  29. #ifndef HF_H
  30. #define HF_H
  31.  
  32. #define GeomHfCreate(f) GeomCreate((GeomRef)HfCreate(f), HfMethods())
  33.  
  34. /*
  35.  * Any height values <= Hf_UNSET is not considered to be part of the
  36.  * height field. Any trianges containing such a vertex will not be
  37.  * rendered.  This allows one to render non-square height fields.
  38.  */
  39. #define HF_UNSET        (-1000.)
  40. /*
  41.  * Number of datapoints in a single cell.  If you've got loads of memory,
  42.  * decrease this number.  The 'optimal' number is quite system-dependent,
  43.  * but something around 20 seems to work well. For systems without much
  44.  * memory, this constant should be greater than or equal to the largest
  45.  * height field which will be rendered, thus making the algorithm
  46.  * non-hierarchical.
  47.  */
  48. #define BESTSIZE        16
  49. /*
  50.  * Size of triangle cache.
  51.  */
  52. #define CACHESIZE        6
  53. /*
  54.  * Used to differentiate between the two triangles used to represent a cell:
  55.  *    a------d
  56.  *      |\     |
  57.  *      | \TRI2|    TRI2 == c-->d-->a-->c
  58.  *      |  \   |
  59.  *      |   \  |
  60.  *    |    \ |
  61.  *      |TRI1 \|    TRI1 == c-->a-->b-->c
  62.  *      b------c
  63.  */
  64. #define TRI1            1
  65. #define TRI2            2
  66.  
  67. typedef struct hfTri {
  68.     Vector v1, v2, v3, norm;
  69.     Float d;
  70.     char type;
  71.     struct hfTri *next, *prev;
  72. } hfTri;
  73.  
  74. typedef struct {
  75.     int len;
  76.     hfTri *head, *tail;
  77. } TriQueue;
  78.  
  79. typedef struct {
  80.     float **data;        /* Altitude points */
  81.     float minz, maxz;
  82.     int size, *lsize;    /* # of points/side */
  83.     int BestSize;         /* "best" division size */
  84.     float iBestSize;    /* inverse of above (for faster computation) */
  85.     int levels;        /* log base BestSize of size */
  86.     float ***boundsmax;    /* high data values at various resolutions. */
  87.     float ***boundsmin;
  88.     float *spacing;
  89.     hfTri hittri, **q;    /* hit triangle and triangle cache */
  90.     int qtail, qsize;    /* end and length of cache */
  91.     Float boundbox[2][3];    /* bounding box of Hf */
  92. } Hf;
  93.  
  94. extern Hf    *HfCreate();
  95. extern int    HfIntersect(), HfEnter(), HfNormal();
  96. extern void    HfBounds(), HfUV(), HfStats();
  97. extern char    *HfName();
  98. extern Methods    *HfMethods();
  99.  
  100. #endif /* HF_H */
  101.